package com.forum.controller.user;

import com.forum.dto.FeedbackDTO;
import com.forum.result.Result;
import com.forum.service.FeedbackService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

import static com.forum.constant.MessageConstant.FEEDBACK_SUCCESSFUL;

@Api(tags = "反馈信息接口")
@RestController("UserFeedbackController")
@RequestMapping("/user/feedback")
@Slf4j
public class FeedbackController {

    @Autowired
    private FeedbackService feedbackService;

    @PostMapping("/save")
    @ApiOperation("反馈信息提交接口")
    public Result save(@RequestBody FeedbackDTO feedbackDTO, HttpServletRequest request){
        feedbackService.save(feedbackDTO,request);
        return Result.success(FEEDBACK_SUCCESSFUL);
    }
}
